Skip to content

feat: Add an nc link parser tool - #234

Merged
marcelklehr merged 3 commits into
mainfrom
feat/nextcloud-links-parser
Sep 8, 2026
Merged

feat: Add an nc link parser tool#234
marcelklehr merged 3 commits into
mainfrom
feat/nextcloud-links-parser

Conversation

@marcelklehr

Copy link
Copy Markdown
Member

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@marcelklehr
marcelklehr requested a balanced review from Copilot September 3, 2026 08:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Pull request overview

Adds a new LangChain tool that parses Nextcloud deep-link URLs into structured identifiers so the agent can route follow-up tool calls appropriately.

Changes:

  • Introduces a Nextcloud URL parser with per-app route handling (Files, Talk, Collectives, Deck, Mail, Calendar, Bookmarks, Cookbook, Forms, Tables).
  • Exposes the parser as a parse_nextcloud_url tool via get_tools().
  • Adds tool-selection “hint” metadata based on the parsed app.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
Comment thread ex_app/lib/all_tools/nextcloud_links.py
Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated

@julien-nc julien-nc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parsing logic looks good.

How does the agent know a link is a Nextcloud one so it would choose to call parse_nextcloud_url for it?

Comment thread ex_app/lib/all_tools/nextcloud_links.py
Comment thread ex_app/lib/all_tools/nextcloud_links.py
Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
Comment thread ex_app/lib/agent.py Outdated
Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
Comment on lines +41 to +42
if key in query and query[key]:
return query[key][0]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check for query[key] being a non-empty list is missing

Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
@marcelklehr
marcelklehr requested review from kyteinsky and a balanced review from Copilot September 3, 2026 12:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

URL resolution, subdirectory routing, identifier placement, and several tool hints currently produce incorrect behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (3)

ex_app/lib/all_tools/nextcloud_links.py:133

  • This anchor only recognizes installations at the domain root. For a valid instance URL such as https://host/nextcloud/index.php/apps/deck/..., the path starts with /nextcloud/..., so every app-scoped parser falls through as unknown even though the system prompt identifies that base URL as belonging to this instance. Match the final /apps/... route after an optional webroot.
	app_match = re.match(r'^/apps/([^/?#]+)(/.*)?$', path)

ex_app/lib/all_tools/nextcloud_links.py:130

  • message_id is emitted at the result's top level, while all other actionable identifiers and the documented contract place identifiers in ids. Consumers inspecting ids will lose the referenced Talk message; include it in the mapping alongside the token.
		return done('talk', 'conversation', {'token': m.group(1)},
					message_id=_int(msg.group(1)) if msg else None)

ex_app/lib/all_tools/nextcloud_links.py:24

  • This hint tells the agent to list rows using view_id, but the only list_rows tool accepts a table_id and calls /tables/{table_id}/rows (all_tools/tables.py:291-307). Passing a view ID as instructed can query the wrong table or fail; do not advertise an unsupported operation.
	'tables': 'Use the Tables tools with table_id (or list rows of the view_id).',
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Balanced

Comment thread ex_app/lib/agent.py Outdated
Comment thread ex_app/lib/agent.py Outdated
Comment thread ex_app/lib/all_tools/nextcloud_links.py
Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
Comment thread ex_app/lib/all_tools/nextcloud_links.py Outdated
Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
marcelklehr force-pushed the feat/nextcloud-links-parser branch from 80492e9 to 8063fb4 Compare September 8, 2026 09:10
Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
@marcelklehr
marcelklehr merged commit 2e641ac into main Sep 8, 2026
4 of 7 checks passed
@marcelklehr
marcelklehr deleted the feat/nextcloud-links-parser branch September 8, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants